#include"files_needed.h"
#include"globals.h"
frameCount::frameCount()
{
	mb_showTime=true;
	 mt_start=0;
	 mt_endT=0;
	mf_delta=0.0f;
	//time passed
	 mf_timeElapsed=0.0f;
	//num of frames in that sec
	 mf_numFrames=0.0f;
	
	//shows the count
	 mc_frames[64]=NULL;
	 sprintf_s(mc_frames, 64, "MyNumber: %.2f", mf_numFrames);
	
}

//draws the text
void frameCount::m_draw(LPD3DXFONT a_font, RECT &a_rect)
{
	SetRect(&a_rect, 0, 20,768, 1366); 
	//SetRect(&a_rect, 0, 20,g_app.m_ScreenWidth, g_app.m_ScreenWidth); 
		// draw the winner text
		a_font->DrawTextA(NULL,
			"GSP: 420",
			-1,
			&a_rect,
			DT_LEFT,
			D3DCOLOR_ARGB(255, 255, 255, 255));

	a_font->DrawText(0,mc_frames, -1, &a_rect, DT_RIGHT , D3DCOLOR_ARGB(255, 255, 255, 255));
	
}
void frameCount::m_update()
{
	
		//update time
		mf_numFrames+=1.0f;
		mf_timeElapsed +=mf_dtEachFrame;

	

		if(mf_timeElapsed >=1.0f)
		{
			//convert to LP
			sprintf_s(mc_frames, 64, "FPS: %.2f", mf_numFrames);
			//reset
			mf_timeElapsed=0.0f;
			mf_numFrames =0.0f;
		}
	

}